package com.example.jetpackdemoapp.tools

import java.lang.reflect.Field

class CommonUtil {
    companion object {
        fun getResId(variableName: String, clazz: Class<*>): Int {
            return try {
                val field: Field = clazz.getField(variableName)
                field.getInt(field)
            } catch (e: Exception) {
                e.printStackTrace()
                -1
            }
        }
    }
}